<template>
	<view class="login">
		<view class="head">
			<text class="title">汽车租赁平台</text>
			<text class="sub-title">Hezhou mine into car rental platform</text>
		</view>
		
		<form>
			<view class="form-item flex align-center">
				<view class="icon">
					<text class="iconfont">&#xe601;</text>
				</view>
				<view class="flex-1 f-input">
					<input v-model="formData.name" type="text" placeholder="请输入您的账号名">
				</view>
			</view>
			<view class="form-item flex align-center">
				<view class="icon">
					<text class="iconfont">&#xe649;</text>
				</view>
				<view class="flex-1 f-input">
					<input v-model="formData.pwd" type="password" placeholder="请输入您的登录密码">
				</view>
			</view>
			
			<view class="btn1 padding-t24">
				<button @click="login">登录</button>
			</view>
			<view class="btn2 padding-t24" @click="goBindPhone">
				<button>无账号租车</button>
			</view>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData: {
					name: '', // 东羽技术01
					pwd: '', // www500520
				}
			};
		},
		onShareAppMessage() {},
		onShareTimeline() {},
		methods: {
			login() {
				if (!this.formData.name) {
					uni.showToast({
						icon: 'none',
						title: '请输入账号名'
					})
					return
				} else if (!this.formData.pwd) {
					uni.showToast({
						icon: 'none',
						title: '请输入登录密码'
					})
					return
				}
				this.$store.dispatch('login/login', this.formData)
			},
			goBindPhone() {
				this.$store.dispatch('login/notAccount')
				
				// uni.navigateTo({
				// 	url: '/pages/bind-phone/bind-phone?type=noAccount'
				// })
			}
		}
	}
</script>

<style lang="scss" scoped>
.login{
	padding: 48rpx;
	
	.head{
		padding: 100rpx 0;
		display: flex;
		align-items: center;
		flex-direction: column;
	}
	
	.title{
		display: block;
		color: #000000;
		font-weight: 600;
		font-size: 44rpx;
		line-height: 62rpx;
	}
	
	.sub-title{
		display: block;
		color: #000000;
		font-weight: 300;
		font-size: 22rpx;
		line-height: 30rpx;
	}
	
	.form-item{
		width: 100%;
		height: 92rpx;
		border-radius: 8rpx;
		margin-bottom: 48rpx;
		background-color: #FFFFFF;
		border: 1px solid #F0F0F0;
	}
	
	.icon{
		width: 64rpx;
		height: 64rpx;
		text-align: center;
		line-height: 64rpx;
	}
	
	.f-input{
		width: 100%;
		border-radius: 8rpx;
	}
	
	button{
		width: 100%;
		height: 92rpx;
		line-height: 92rpx;
		border: none;
		&::after{
			border: none;
		}
	}
	.btn1{
		
		button{
			color: #FFFFFF;
			font-weight: 400;
			font-size: 34rpx;
			background-color: var(--primary-color);
		}
	}
	
	.btn2{
		
		button{
			font-weight: 400;
			font-size: 34rpx;
			color: var(--primary-color);
			background-color: transparent;
		}
	}
}
</style>
